package com.ltz.web.report;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ltz.model.MonthlyProductData;
import com.ltz.model.Page;
import com.ltz.model.User;
import com.ltz.service.report.MonthlyProductService;

@Controller
@RequestMapping(value="/monPrd")
public class MonthlyProductController {
	@Resource
	private MonthlyProductService monPrdService;

	@ResponseBody
	@RequestMapping("loadList")
	public Page loadList(Page page,String queryStr){
		return monPrdService.loadList(page,queryStr);
	}
	@RequestMapping(value="doAddMonPrd",method=RequestMethod.POST)
	public String doAddWell(MonthlyProductData w,HttpServletRequest request){
		User user=(User) request.getSession().getAttribute("user");
//		w.setDate(request.getParameter("date"));
		monPrdService.doAddMonPrd(user, w);
		return "/save_ok";
	}
	@RequestMapping(value="doUpdateMonPrd",method=RequestMethod.POST)
	public String doUpdateWell(HttpServletRequest request,MonthlyProductData w){
		User user=(User) request.getSession().getAttribute("user");
		monPrdService.doUpdateMonPrd(user,w);
		return "/save_ok";
	}
	@ResponseBody
	@RequestMapping("doDeleteMonPrd")
	public Boolean doDeleteWellGroup(int recordId){
		return monPrdService.doDeleteMonPrd(recordId);
	}
	@ResponseBody
	@RequestMapping("getWellList")
	public List getWellList(){
		return monPrdService.getWellList();
	}
	@RequestMapping("exportExcel")
	public void exportExcel(HttpServletRequest request, HttpServletResponse response){
		monPrdService.exportExcel(request, response);
	}
}
